import { BaseEntity } from '../../base/entity/base';
import { Column, Entity, Index } from 'typeorm';

/**
 * 商品价格层级
 */
@Entity('goods_price')
export class GoodsPriceEntity extends BaseEntity {
  @Index()
  @Column({ comment: '商品ID' })
  goodsId: number;

  @Column({
    comment: '价格层级',
    dict: ['基础价格', 'VIP价格', '批发价格', '合作伙伴价格', '区域代理价格'],
    default: 0,
  })
  priceLevel: number;

  @Column({
    comment: '价格',
    type: 'decimal',
    precision: 12,
    scale: 2,
  })
  price: number;

  @Column({ comment: '最小购买数量', default: 1 })
  minQuantity: number;

  @Column({ comment: '最大购买数量', nullable: true })
  maxQuantity: number;

  @Column({ comment: '生效时间', nullable: true })
  startTime: Date;

  @Column({ comment: '失效时间', nullable: true })
  endTime: Date;

  @Column({ comment: '状态', dict: ['禁用', '启用'], default: 1 })
  status: number;

  @Column({ comment: '备注', nullable: true })
  remark: string;
}
